//
//  FindTableViewCell.m
//  Funny
//
//  Created by dllo on 15/10/28.
//  Copyright © 2015年 King. All rights reserved.
//

#import "FindTableViewCell.h"
@implementation FindTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.bgImageView = [[UIImageView alloc]init];
        self.bgImageView.layer.masksToBounds = YES;
        self.bgImageView.layer.cornerRadius = 5;
        [self.contentView addSubview:_bgImageView];
        
        self.addressLable =[[UILabel alloc]init];
        self.addressLable.textColor = [UIColor whiteColor];
        self.addressLable.textAlignment = NSTextAlignmentCenter;
        self.addressLable.font = [UIFont systemFontOfSize:14];
        self.addressLable.layer.masksToBounds = YES;
        self.addressLable.layer.cornerRadius = 12;
        self.addressLable.backgroundColor = [UIColor colorWithRed:55/255.0 green:55/255.0 blue:55/255.0 alpha:0.5];
        [self.bgImageView addSubview:_addressLable];

        self.infoLable = [[UILabel alloc]init];
        self.infoLable.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:_infoLable];
        
        self.blackImageView =[[UIImageView alloc]init];
        [self.blackImageView setImage:[UIImage imageNamed:@"image.png"]];
        [self.bgImageView addSubview:_blackImageView];
        
        self.titleLble = [[UILabel alloc]init];
        self.titleLble.textColor = [UIColor whiteColor];
        self.titleLble.font = [UIFont systemFontOfSize:14];
        [self.blackImageView addSubview:_titleLble];
        
}
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.bgImageView.frame = CGRectMake(5 * W, 5 * H, self.contentView.bounds.size.width - 10 * W, self.contentView.bounds.size.height-50 * H);
    self.addressLable.frame = CGRectMake(10 * W, 5 * H, 60 * W, 25 * H);
    self.titleLble.frame = CGRectMake(10 * W, 0, 350 * W, 40 * H);
    self.infoLable.frame = CGRectMake(10 * W, self.contentView.bounds.size.height-50 * H, self.contentView.bounds.size.width - 10 * W, 40 * H);
    self.blackImageView.frame = CGRectMake(0, self.bgImageView.bounds.size.height-40 * H, self.bgImageView.bounds.size.width, 40 * H);
    
}



#pragma mark -cell赋值方法
- (void)setModel:(FindModel *)model
{
    [self.bgImageView sd_setImageWithURL:[NSURL URLWithString:model.bigImageUrl]];
    self.addressLable.text = model.cityName;
    self.titleLble.text = model.productName;
    self.infoLable.text = model.productTitleContent;

}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
